﻿using System;
using System.Windows;
using System.Windows.Input;

namespace ExampleApp2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private WinHooksNET.HotKeysModule _hotKeysModule = new WinHooksNET.HotKeysModule();

        public MainWindow()
        {
            InitializeComponent();

            //Register hot keys
            _hotKeysModule.RegisterHotKey("First hotKey", Key.LeftCtrl, Key.A);
            _hotKeysModule.RegisterHotKey("Second hotKey", Key.Q, Key.W, Key.E);

            _hotKeysModule.OnHotKeyAction += _hotKeysModule_OnHotKeyAction;
        }

        void _hotKeysModule_OnHotKeyAction(object sender, WinHooksNET.Events.HotKeyEventArgs e)
        {
            String hotKeyText = "Name: " + e.Name;      //Hot key Name
            hotKeyText += ", keys:";

            for (int i = 0; i < e.Keys.Count; i++)      //List of keys in this hot key
            {
                hotKeyText += " " + e.Keys[i].ToString();
            }

            LB_HotKeys.Items.Insert(0, hotKeyText); 
        }
    }
}
